import Login from '@/views/Login'
import store from '@/store';
import mainRouter from "./mainRouter";

const routes = [
  {
    path:'/',
    redirect: '/main'
  },
  {
    path:'/login',
    component: Login,
    meta: {
      title:'登录'
    }
  },
  {
    path:'/main',
    component: ()=>import('@/views/Main'),
    children:mainRouter
  },
  {
    path:'/404',
    component: ()=>import('@/views/404'),
    meta: {
      title:'404'
    }
  },
  {
    path:'/401',
    component: ()=>import('@/views/401'),
    meta: {
      title:'401'
    }
  }

];

export function getAsideData() {
  console.log(store.state.permission.routes);
  return store.state.permission.routes.filter(item => item.meta).filter(item => item.meta.title).map(item => {
    return {
      title: item.meta.title,
      toPath: routes[2].path + '/' + item.path
    }
  });
}


export default routes
